export function alert(content, title = '提示') {
  console.log(content)
  return new Promise((resolve, reject) => {
    wx.showModal({
      title: title,
      content: content,
      cancel: true,
      showCancel: false,
      success() {
        resolve();
      },
      fail(err) {
        reject(err)
      }
    });
  })
}

export function toast(title) {
  return new Promise((resolve, reject) => {
    wx.showToast({
      title: title,
      success() {
        resolve();
      },
      fail(err) {
        reject(err);
      }
    })
  });
}

export function loading(title, mask = true) {
  return new Promise((resolve, reject) => {
    wx.showLoading({
      title: title,
      mask: mask
    })
    setTimeout(function () {
      wx.hideLoading()
    }, 2000)
  });
}
export default { alert: alert, toast: toast, loading: loading }